package club.xyes.zkh.ecommerce.commons.context;

import java.time.ZoneId;

/**
 * Create by 郭文梁 2019/4/15 0015 15:03
 * ApplicationConstants
 * 系统常量
 *
 * @author 郭文梁
 * @data 2019/4/15 0015
 */
public class ApplicationConstants {
    /**
     * 默认时区
     */
    public static final ZoneId DEFAULT_TIMEZONE = ZoneId.systemDefault();
    /**
     * 系统默认编码
     */
    public static final String DEFAULT_CHARSET = "UTF-8";
    /**
     * 默认时间如期格式
     */
    public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    /**
     * 时间格式
     */
    public static final String TIME_FORMAT = "HH:mm:ss";
    /**
     * 日期格式
     */
    public static final String DATE_FORMAT = "yyyy-MM-dd";

    /**
     * 上下文 系统常量
     */
    public static class Context {
        /**
         * Mapper组建所在的包名
         */
        public static final String MAPPER_PACKAGE = "club.xyes.zkh.ecommerce.dao.mapper";
        /**
         * 控制器(API)所在的包
         */
        public static final String API_CONTROLLER_PACKAGE = "club.xyes.zkh.ecommerce.web";
        /**
         * 组件所在的基础包
         */
        public static final String COMPONENT_PACKAGE = "club.xyes.zkh.ecommerce";
    }

    public static class Security {
        /**
         * 权限分隔符
         */
        public static final String AUTHORITY_DELIMITER = ",";
        /**
         * 微信注册使用的默认密码
         */
        public static final String WECHAT_REGISTER_DEFAULT_PASSWORD = "";
        /**
         * API地址matcher
         */
        public static final String API_BASE_URL = "/api/**";
        /**
         * 管理员URL matcher
         */
        public static final String BACKSTAGE_BASE_URL = "/backstage/**";
        /**
         * Swagger 地址
         */
        public static final String SWAGGER_URL = "/swagger-ui.html";
        /**
         * Web Jar 地址
         */
        public static final String WEB_JAR_URL = "/webjars/**";
        /**
         * API登录地址
         */
        public static final String USER_API_LOGIN_URL = "/api/user/_login-by-micro-program-code";
        /**
         * 商家登录地址
         */
        public static final String SHOP_API_LOGIN_URL = "/api/shop/login";
        /**
         * API调用时 保存在Header中的AccessToken名称
         */
        public static final String API_ACCESS_TOKEN_HEADER = "Api-Access-Token";
        /**
         * 保存最小用户对象的参数名称
         */
        public static final String ACCESS_TOKEN_USER_INFO_KEY = "minimal-user";
        /**
         * 保存最小商铺对象的参数名称
         */
        public static final String ACCESS_TOKEN_SHOP_INFO_KEY = "minimal-shop";
        /**
         * 商铺令牌前缀
         */
        public static final String TOKEN_SHOP_PREFIX = "shop/";
        /**
         * 用户令牌前缀
         */
        public static final String TOKEN_USER_PREFIX = "user/";
    }

    /**
     * 数据库相关常量
     */
    public static class Database {
        /**
         * JDBC主键生成器名称
         */
        public static final String GENERATOR_JDBC = "JDBC";
        /**
         * 降序排序
         */
        public static final String ORDER_DESC = "desc";
        /**
         * 升序排序
         */
        public static final String ORDER_ASC = "asc";
    }

    /**
     * Http相关常量
     */
    public static class Http {
        /**
         * 内容类型 JSON 编码 UTF-8
         */
        public static final String CONTENT_TYPE_JSON_UTF8 = "application/json;charset=utf-8";
    }
}
